package cn.chendd.plugins.toolbars;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

/**
 * GBK
 */
public class ToolbarHelloAction extends AnAction {

    @Override
    public void actionPerformed(AnActionEvent e) {
        consumer(e , this);
    }

    public static void consumer(AnActionEvent e, AnAction action) {
        String actionId = e.getActionManager().getId(action);
        if (actionId == null) {
            Messages.showMessageDialog("Undefined", "Hello", Messages.getInformationIcon());
            return;
        }
        final Presentation property = e.getPresentation();
        Messages.showMessageDialog(property.getDescription(), property.getText(), Messages.getInformationIcon());
    }

}
